package com.workflow.workflowproject.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

import java.io.Serial;

import com.mybatisflex.core.keygen.KeyGenerators;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 *  实体类。
 *
 * @author sht05
 * @since 2024-11-04
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("t_com_flow_data")
public class FlowData implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 流程业务ID
     */
    @Id(keyType = KeyType.Generator,value= KeyGenerators.snowFlakeId)
    private String id;

    /**
     * 流程定义id
     */
    @Column(value = "flow_id")
    @Schema(description = "流程定义id")
    private Integer flowId;

    /**
     * 流程实例ID
     */
    @Column(value = "process_instance_id")
    @Schema(description = "流程实例ID")
    private String processInstanceId;

    /**
     * 状态（0、待审批；1、流程通过；2、流程驳回；3、流程暂存；）
     */
    @Column(value = "state")
    @Schema(description = "状态（0、待审批；1、流程通过；2、流程驳回；3、流程暂存；）")
    private Integer state;

    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "create_time",onInsertValue = "now()")
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "update_time",onUpdateValue = "now()")
    @Schema(description = "修改时间")
    private LocalDateTime updateTime;

    /**
     * 是否存在
     */
    @Column(value = "exist",isLogicDelete = true)
    @Schema(description = "是否删除")
    private Integer exist;

}
